home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000061_icon-group-sender _Wed Sep 10 14:23:39 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 10 Sep 1997 14:23:38 -0500 (EST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA31626; Wed, 10 Sep 1997 12:23:37 -0700
To: icon-group
Date: Wed, 10 Sep 1997 13:59:41 GMT
From: ltest@rte9-sun_5.5.1 (news_check.py)
Message-Id: <5v69d2$4su@lztnsc06.att.com>
Organization: AT&T WorldNet Load Test
Sender: icon-group-request
References: <Stuart.Robinson-0209972348010001@asianstmg-221.anu.edu.au>
Subject: Re: More specific GREP-related question
Errors-To: icon-group-errors
Status: RO
In article <5uh7b5$gd7@news-central.tiac.net> mike@stok.co.uk (Mike Stok) wrote:
> In article <Stuart.Robinson-0209972348010001@asianstmg-221.anu.edu.au>,
> Stuart Robinson <Stuart.Robinson@anu.edu.au> wrote:
> >Does anyone know how regular expressions like [a-z] work when a
In article <Stuart.Robinson-0209972348010001@asianstmg-221.anu.edu.au>,
Stuart Robinson <Stuart.Robinson@anu.edu.au> wrote:
>Does anyone know how regular expressions like [a-z] work when a
>non-alphanumeric character is used? For example, which characters would
>the following regular expression match?
>
>[1-!]
If you actually use that in a regex on a system with ASCII encoding (or
one of the character sets wherer the low 128 characters are ASCII) you
should get an "invalid [] range in regexp" warning as perl likes to work
with ascending ranges. In ASCII you're asking for a range from character
49 up to character 33
>What about this one?
>
>[a-1]
>
>And the reverse?
>
>[1-a]
1-a will match a character in the range characters 49 to 97 inclusive, so
in the debugger I can use perl's ord and chr functions to see what
characters are in that range:
DB<1> print ord '1'
49
DB<2> print ord 'a'
97
DB<3> print map {chr $_} (49 .. 97)
123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`a
>I'm sure all of this could be predicted if one had knowledge of the
>ordering of ASCII, but I'm afraid I lack such knowledge. Any tips?
If you're on a unix system then there is usually a manual page for ascii,
so
man ascii
should get you a useful page. Failing that a www search or a reference
book might have a table of ascii codes in it (printer manuals usually have
tables of characters somewhere in them...)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)